<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改派遣任务')" />
            <th:block th:include="include :: datetimepicker-css" />
            <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<style>
    .jltable{
        margin: auto;
    }
    .jltable th,td{
        min-height: 40px;
        min-width: 50px;
        border: 1px solid #eee;
        padding: 10px;
    }
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-pqrw-edit" th:object="${lwpqPqrw}">
        <table class="jltable">
            <tbody>
        <input name="id" th:field="*{id}" type="hidden">
                    <tr>
                        <td><label class="control-label">类型：</label></td>
                        <td>
                            <select name="lx" class="form-control" th:with="type=${@dict.getType('pqrwlx')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{lx}"></option>
                            </select>
                        </td>
                        <td></td><td></td>
                    </tr>
                        <tr>
                            <td><label class="control-label">标题：</label></td>
                            <td colspan="3"> <input name="bt" th:field="*{bt}" class="form-control" type="text"></td>
                        </tr>
                        <tr>
                            <td><label class="control-label">所属项目：</label></td>
                            <td> <input name="ssxm" th:field="*{ssxm}" class="form-control" type="text"></td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td><label class="control-label">分配给：</label></td>
                            <td colspan="3"> <input name="fpg" th:field="*{fpg}" class="form-control" type="text"></td>
                        </tr>
                    <tr>
                        <td><label class="control-label">说明：</label></td>
                        <td colspan="3"><textarea name="sm" class="form-control">[[*{sm}]]</textarea></td>
                    </tr>
                    <tr>
                        <td><label class="control-label">开始时间：</label></td>
                        <td>
                            <div class="input-group date">
                                <input name="kssj" th:value="${#dates.format(lwpqPqrw.kssj, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                                <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                            </div>
                        </td>
                        <td><label class="control-label">截至时间：</label></td>
                        <td>
                            <div class="input-group date">
                                <input name="jzsj" th:value="${#dates.format(lwpqPqrw.jzsj, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                                <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                            </div>
                        </td>
                    </tr>
                        <tr>
                            <td><label class="control-label">创建人：</label></td>
                            <td> <input name="cjr" th:field="*{cjr}" class="form-control" type="text"></td>
                            <td><label class="control-label">创建时间：</label></td>
                            <td>
                                <div class="input-group date">
                                    <input name="cjsj" th:value="${#dates.format(lwpqPqrw.cjsj, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                </div>
                            </td>
                        </tr>
                    <tr>
                    </tr>
                        <tr>
                            <td><label class="control-label">相关文件：</label></td>
                            <td colspan="3">
                                <input type="hidden" name="xgwj">
                                <div class="file-loading">
                                    <input class="form-control file-upload" id="xgwj" name="file" type="file">
                                </div>
                            </td>
                        </tr>
            </tbody>
        </table>
    </form>
</div>
<th:block th:include="include :: footer" />
        <th:block th:include="include :: datetimepicker-js" />
        <th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
    var prefix = ctx + "lwpq/pqrw";
    $("#form-pqrw-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-pqrw-edit').serialize());
        }
    }

            $("input[name='kssj']").datetimepicker({
                format: "yyyy-mm-dd",
                minView: "month",
                autoclose: true
            });

            $("input[name='jzsj']").datetimepicker({
                format: "yyyy-mm-dd",
                minView: "month",
                autoclose: true
            });

            $("input[name='cjsj']").datetimepicker({
                format: "yyyy-mm-dd",
                minView: "month",
                autoclose: true
            });

            $(".file-upload").each(function (i) {
                var val = $("input[name='" + this.id + "']").val()
                $(this).fileinput({
                    'uploadUrl': ctx + 'common/upload',
                    initialPreviewAsData: true,
                    initialPreview: [val],
                    maxFileCount: 1,
                    autoReplace: true
                }).on('fileuploaded', function (event, data, previewId, index) {
                    $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
                }).on('fileremoved', function (event, id, index) {
                    $("input[name='" + event.currentTarget.id + "']").val('')
                })
                $(this).fileinput('_initFileActions');
            });
</script>
</body>
</html>